package controllers

import (
	"github.com/astaxie/beego"
	//"fmt"
	"beego/testApp/common/user"
	"strconv"
//	"beego/testApp/common/tool"
)

type UserListController struct {
	beego.Controller
}



func (c *UserListController) Get() {


	 getpage := user.Page(10)
	 //tool.Pic("getpage",getpage)

	 //var users []string
	 page := c.GetString("page")

	 var users []user.Admin 

	 if(page!=""){

	   intpage,_ := strconv.Atoi(page)
	   users = user.List(intpage,10);
	 }else{
       users = user.List(1,10);
	 }
	 
	 //fmt.Println(users);

	c.Data["users"]= users;
	c.Data["page"] = getpage;

	c.TplName = "userlist.html"
}
